package org.birrap.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name = "VASOS_T")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "VasosT.findAll", query = "SELECT v FROM VasosT v"),
    @NamedQuery(name = "VasosT.findByIdVaso", query = "SELECT v FROM VasosT v WHERE v.idVaso = :idVaso"),
    @NamedQuery(name = "VasosT.findByTipo", query = "SELECT v FROM VasosT v WHERE v.tipo = :tipo"),
    @NamedQuery(name = "VasosT.findByCapacidad", query = "SELECT v FROM VasosT v WHERE v.capacidad = :capacidad")})
@SequenceGenerator (name="SEQ_VASOS_T" , sequenceName ="SEQ_VASOS_T" , allocationSize = 1)
public class VasosT implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_VASO")
    @GeneratedValue (strategy = GenerationType.SEQUENCE, generator = "SEQ_VASOS_T")
    private Integer idVaso;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "TIPO")
    private String tipo;
    @Size(max = 15)
    @Column(name = "CAPACIDAD")
    private String capacidad;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "vasosT")
    private Collection<BaresCervezasTapasVasosT> baresCervezasTapasVasosTCollection;

    public VasosT() {
    }

    public VasosT(Integer idVaso) {
        this.idVaso = idVaso;
    }

    public VasosT(Integer idVaso, String tipo) {
        this.idVaso = idVaso;
        this.tipo = tipo;
    }

    public Integer getIdVaso() {
        return idVaso;
    }

    public void setIdVaso(Integer idVaso) {
        this.idVaso = idVaso;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public String getCapacidad() {
        return capacidad;
    }

    public void setCapacidad(String capacidad) {
        this.capacidad = capacidad;
    }

    @XmlTransient
    public Collection<BaresCervezasTapasVasosT> getBaresCervezasTapasVasosTCollection() {
        return baresCervezasTapasVasosTCollection;
    }

    public void setBaresCervezasTapasVasosTCollection(Collection<BaresCervezasTapasVasosT> baresCervezasTapasVasosTCollection) {
        this.baresCervezasTapasVasosTCollection = baresCervezasTapasVasosTCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idVaso != null ? idVaso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VasosT)) {
            return false;
        }
        VasosT other = (VasosT) object;
        if ((this.idVaso == null && other.idVaso != null) || (this.idVaso != null && !this.idVaso.equals(other.idVaso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.birrap.ejb.VasosT[ idVaso=" + idVaso + " ]";
    }
    
}
